<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <%layout("/WEB-INF/view/common/inc/admin_head.html",{title:'', styles:'bootstrap,font-awesome,animate,style,bootstrap-table,layui-date,auto-complete,dtvalidate,layui,chosen'}){%>
    <style type="text/css">
        body{padding-top:10px;
            padding-left: 10px;}
        *{margin:0;padding:0;list-style-type:none;}
        a,img{border:0;}
        .demo h2{font-size:16px;color:#3366cc;height:30px;}
        .demo li{float:left;}
    </style>
    <%}%>
</head>

<body>
<div class="row">
    <div class="col-sm-12">
        <!-- START 右侧数据 -->
        <div class="ibox float-e-margins" style="margin-bottom: 0px;">
            <div class="ibox-content" style="padding:15px 20px 0px 20px;">
                <form id="search-form" role="form" class="form-horizontal">
                    <input type="hidden" readonly id="productMember" name="productMember" class="form-control" value="${user.userRealname}">
                    <div class="form-group">
                        <label class="control-label col-sm-1">时间:</label>
                        <div class="col-sm-2">
                            <input type="text" id="stockDate" name="stockDate"   class="form-control">
                        </div>
                        <label class="control-label col-sm-1">SKU:</label>
                        <div class="col-sm-2">
                            <input type="text" id="productSku" name="productSku" class="form-control">
                        </div>
                        <a class="search-btn btn btn-success" style="margin-bottom: 0px;">查询</a>
                    </div>
                </form>
            </div>
            <!-- START 操作按钮 -->
            <form>
                <div id="toolbar" class="btn-group" style="margin-bottom:5px;">
                    <a class="test-btn btn btn-sm btn-success"><i class="fa fa-plus" aria-hidden="true"></i> 测试</a>
                    <button  class="export-btn layui-btn  layui-btn-sm" style="margin-left: -2px">
                        <i class="fa fa-download" aria-hidden="true"></i> 导出当前数据
                    </button>
                </div>
            </form>
            <!-- END 操作按钮 -->

            <!-- START 数据表格 -->
            <table id="relatedTable"
                   data-toolbar="#toolbar"
                   data-side-pagination="server"
                   data-pagination="true"
                   data-resizable="true"
                   data-url="/sea/finance/inventoryStock/findByCnd.do"
                   data-page-size="15"
                   class="table table-striped table-hover"
            >
            </table>
            <!-- END 数据表格 -->
        </div>
    </div>
</div>
<%layout("/WEB-INF/view/common/inc/admin_js.html",{modules:'jquery,bootstrap,bootstrap-table,bootstrap-table-zh-CN,dtvalidate,dtvalidate-lang-zh_cn,laydate,layer,layui,chosen,chosen-demo,upload'}){}%>
<script>
    laydate.render({
        elem: '#stockDate',
        type: 'month'
        ,trigger: 'click'
    });
    var $relatedTable = $('#relatedTable');
    $(function(){
        //START 表格配置
        $relatedTable.bootstrapTable({
            columns: [
                {
                    title: '时间',
                    field: 'stockDate',
                    align: 'center',
                    valign: 'middle'
                },
                {
                    title: '渠道',
                    field: 'productPropertyName',
                    align: 'center',
                    valign: 'middle'
                },
                {
                    title: 'SKU',
                    field: 'productSku',
                    align: 'center',
                    valign: 'middle'
                },
                {
                    field: 'productName',
                    title: '产品名称',
                    align: 'center'
                },

                {
                    title: '采购在产',
                    field: 'produceNumber',
                    align: 'center',
                    valign: 'middle'
                },

                {
                    title: '国内仓库存',
                    field: 'wareNumber',
                    align: 'center',
                    valign: 'middle'
                },
                {
                    title: '海外仓库存',
                    field: 'stockNumber',
                    align: 'center',
                    valign: 'middle'
                },
                {
                    title: '实际在途(FBA)',
                    field: 'createNumber',
                    align: 'center',
                    valign: 'middle'
                },
                {
                    title: '实际在途(海外仓)',
                    field: 'createWareNumber',
                    align: 'center',
                    valign: 'middle'
                },
                {
                    title: '实际在途(海外仓-FBA)',
                    field: 'createPortNumber',
                    align: 'center',
                    valign: 'middle'
                }
            ],
            onLoadSuccess : function(){


            }
        });
        //新增
        $('.search-btn').on('click',function(){
            $relatedTable.bootstrapTable('refresh', { url:'${ctxPath}/sea/finance/inventoryStock/findByCnd.do?'+$('#search-form').serialize() });
        });


    });
    //提交表单
    $('.test-btn').on('click',function(){

        layer.confirm('确定要付款当前数据？', {
            btn: ['确定','取消'],title:'提示'
        }, function(){
            layer.closeAll();
            var index=layer.load();
            $.post('/sea/finance/inventoryStock/test.do',{},function(data){
                if( data.ok ){
                    $relatedTable.bootstrapTable('refresh');
                    layer.msg(data.msg,{icon:1,time:1500,shade: [0.8, '#393D49']});
                    layer.close(index);
                }else{
                    layer.msg(data.msg,{icon: 0,time:1500,shade: [0.8, '#393D49']});
                    layer.close(index);
                }
            });
        });
    });
    $(".export-btn").click(function () {
        window.location.href='/sea/finance/inventoryStock/export?'+$('#search-form').serialize();
    });

</script>
</body>
</html>
